<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=basePath%>">
<title>Insert title here</title>
</head>
<body>

	<script type="text/javascript">
	var treeData;	//树形菜单的数据
	$(function(){
		$.post("sysRole/searchPers",{rid : ${param.rid}},function(data){
			$("#assignPermissions").tree({
				url : "sysPermission/list",
				checkbox:true,
				loadFilter:function(data){
					treeData = data;
					return data;
				},
				onLoadSuccess:function(){
					$.each(treeData,function(){
						$.each(this.children,function(){
							var node = $("#assignPermissions").tree("find",this.id);
							var index = $.inArray(this.id,data);
							if(index != -1){
								$('#assignPermissions').tree('check', node.target);
							}else{
								$('#assignPermissions').tree('uncheck', node.target);
							}
						});
					});
				}
			});
		});
	});
</script>

	<ul id="assignPermissions"></ul>
</body>
</html>